
TOOLCHAIN=../../buildroot/build_i386/staging_dir
CC=$(TOOLCHAIN)/usr/bin/i386-linux-uclibc-gcc
OPTS= -Wall -D_GNU_SOURCE
HDRS= -I $(TOOLCHAIN)/usr/include -I ctrlpt/ -I device/ -I common/
LIBS= 



# -- default -----------------------------------------------------------------
default: upnp-query upnpcpd micropik-ps3x8 agent-events
	$(CC) $(OPTS) -DTEST device/ps3x8.c -o bin/ps3x8

# -- micropik-ps3x8 ----------------------------------------------------------
MICROPIK_OBJS = common/util.o \
                common/upnplog.o \
                device/upnpdev.o \
                device/ps3x8.o \
                
micropik-ps3x8: $(MICROPIK_OBJS) 
	$(CC) $(OPTS) $(HDRS) $(LIBS) -lupnp -lixml $(MICROPIK_OBJS) device/upnpdev_micropik_ps3x8.c -o bin/upnpdev-micropik-ps3x8
	$(CC) -DDUMMY $(OPTS) $(HDRS) $(LIBS) -lupnp -lixml $(MICROPIK_OBJS) device/upnpdev_micropik_ps3x8.c -o bin/upnpdev-micropik-dummy

# -- agent-events ------------------------------------------------------------
AGENTEVENTS_OBJS = common/util.o \
                   common/upnplog.o \
                   device/upnpdev.o \
                
agent-events: $(AGENTEVENTS_OBJS) 
	$(CC) $(OPTS) $(HDRS) $(LIBS) -lupnp -lixml $(AGENTEVENTS_OBJS) device/upnpdev_agent_events.c -o bin/upnpdev-agent-events


# -- upnp-query --------------------------------------------------------------
UPNPCP_CC =  $(CC) $(OPTS) $(HDRS) $(LIBS) -lupnp -lixml
UPNPCP_MAIN = ctrlpt/upnp_query_main.c
UPNPCP_OBJS = common/util.o ctrlpt/upnp_query.o 
UPNPCP_BIN = bin/upnp-query
                
upnp-query: $(UPNPCP_OBJS) 
	$(UPNPCP_CC) $(UPNPCP_OBJS) $(UPNPCP_MAIN) -o $(UPNPCP_BIN)

# -- upnpcpd -----------------------------------------------------------------
UPNPCPD_CC =  $(CC) $(OPTS) $(HDRS) $(LIBS) -lupnp -lixml
UPNPCPD_MAIN = ctrlpt/upnpcpd.c
UPNPCPD_OBJS = common/util.o common/upnplog.o 
UPNPCPD_BIN = bin/upnpcpd
                
upnpcpd: $(UPNPCPD_OBJS) 
	$(UPNPCPD_CC) $(UPNPCPD_OBJS) $(UPNPCPD_MAIN) -o $(UPNPCPD_BIN)



# -- standard object ----------------------------------------------------------
%.o: %.c %.h
	$(CC) $(OPTS) $(HDRS) -c $< -o $@


clean:
	rm -f bin/*
	rm -f */*.o 
	rm -fr pkg/o*


